//
//  NetworkingHandler.m
//  Travel_M_Travel
//
//  Created by dlios on 15-3-25.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "NetworkingHandler.h"
#import "AFHTTPRequestOperationManager.h"
#import "AFHTTPSessionManager.h"
@implementation NetworkingHandler
+ (void)requestWithUrl:(NSString *)urlStr completion:(void (^)(NSDictionary *))block
{
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    [manager GET:urlStr parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        id result = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSLog(@"Success~~~~~~: %@", responseObject);
        block(result);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error);
        NSLog(@"请求错误");
    }];
    
}
@end
